The options form (in RapidSpellDialog or invoked programmatically) allows the user to store their own spell check preferences and also edit their user dictionary.
By default, user options are enabled and stored under .NET's IsolatedStorage. It's important to remember that user options (if enabled) will override the properties set in the spell checker controls (eg. RapidSpellAsYouType.CheckAsYouType = true will have no effect if the user has disabled check as you type).
Ensure that any of the settings specified below are made in both RapidSpellDialog and RapidSpellAsYouType as one will override the other if used with RapidSpellAYTDialogCoupler.
Dim o As Options.UserOptions = rapidSpellDialog1.Options rapidSpellDialog1.Options.SetUserOptions(o.CheckAsYouType, o.IncludeUserDictionaryInSuggestions, _ o.IgnoreWordsWithDigits, o.IgnoreURLsAndEmailAddresses, o.IgnoreCapitalizedWords, _ o.AllowMixedCase, o.AllowAnyCase, o.FindSuggestions, False) rapidSpellDialog1.Options.Save()
OptionsPresenter optionsPresenter = rapidSpellAsYouType1.OptionsPresenter; if (optionsPresenter.Show(this, rapidSpellAsYouType1.Options)) { rapidSpellAsYouType1.Options.Save(); }
Events are available which can be used to determine when to prepare a stream to read/write to.
For example, to use a custom stream to write to an XML file;
......... Public Sub New() MyBase.New InitializeComponent rapidSpellAsYouType1.OptionsStorageLocation = Keyoti.RapidSpell.Options.UserOptions.StorageType.Stream rapidSpellDialog1.OptionsStorageLocation = Keyoti.RapidSpell.Options.UserOptions.StorageType.Stream Dim options As Keyoti.RapidSpell.Options.UserOptions = New Keyoti.RapidSpell.Options.UserOptions options.StorageLocation = Keyoti.RapidSpell.Options.UserOptions.StorageType.Stream AddHandler options.NeedCustomStreamForSaving, AddressOf Me.NeedSaveStream AddHandler options.NeedCustomStreamForLoading, AddressOf Me.NeedLoadStream AddHandler options.OptionsSaved, AddressOf Me.options_OptionsSaved options.Load rapidSpellAsYouType1.Options = options rapidSpellDialog1.Options = options rapidSpellAsYouType1.TextBoxBase = Me.aytTextBox1 End Sub Private Sub options_OptionsSaved(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Event.OptionsSavedEventArgs) 'update the DB? End Sub Private Sub NeedSaveStream(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Options.NeedStreamEventArgs) e.RequiredStream = New System.IO.FileStream("c:\useropt.xml", System.IO.FileMode.Truncate, System.IO.FileAccess.Write) End Sub Private Sub NeedLoadStream(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Options.NeedStreamEventArgs) e.RequiredStream = New System.IO.FileStream("c:\useropt.xml", System.IO.FileMode.OpenOrCreate) End Sub .........
1. RapidSpellAsYouType.TextComponent or .TextBoxBase must be set AFTER options.Load. This is because otherwise the options are loaded from the default location as soon as the textbox is set.
2. You can use the OptionsSaved event to write the stream's contents to a DB instead.